package com.dragon.repository.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dragon.repository.entity.AttendanceArrange;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 考勤配置 Mapper 接口
 * </p>
 *
 * @author sy
 * @since 2023-07-31
 */
@Mapper
public interface AttendanceArrangeMapper extends BaseMapper<AttendanceArrange> {

    @Select("SELECT DISTINCT a.* FROM dragon_attendance_arrange a " +
            "LEFT JOIN dragon_arrange_personnel b ON b.arrange_id = a.id " +
            "LEFT JOIN dragon_admin_department c ON c.admin_id = b.admin_id " +
            "LEFT JOIN dragon_admin d ON d.id = c.admin_id " +
            "LEFT JOIN dragon_department e ON e.id = c.department_id " +
            "${ew.customSqlSegment}")
    Page<AttendanceArrange> queryByPage(Page<AttendanceArrange> arrangePage,
                                        @Param(Constants.WRAPPER)QueryWrapper<AttendanceArrange> wrapper);

}
